package com.wiloon.java.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;
import java.util.Map;

/**
 * Created by wiloon on 2/29/16;
 */
@Controller
public class FooController {
    private static Logger logger = LoggerFactory.getLogger(FooController.class);

    @RequestMapping("list")
    public ModelAndView list() {
        return new ModelAndView("bootstrap/list");
    }

    @RequestMapping("form")
    public ModelAndView add() {
        return new ModelAndView("bootstrap/form");
    }

    @RequestMapping("save")
    public ModelAndView save() {
        return new ModelAndView("bootstrap/list");
    }

    @RequestMapping("upload")
    public ModelAndView upload() {
        return new ModelAndView("bootstrap/fileUpload");
    }

    @RequestMapping("home")
    public ModelAndView home() {
        return new ModelAndView("bootstrap/home");
    }

    @RequestMapping("foo")
    public ModelAndView foo() {
        return new ModelAndView("bar");
    }


    @RequestMapping("/")
    public String index() {
        logger.info("index controller.");
        return "index";
    }

//    @GetMapping("/")
//    public String welcome(Map<String, Object> model) {
//        model.put("time", new Date());
//        model.put("message", "msg");
//        return "welcome";
//    }
}
